﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace Agresso.Interface.Layer.Domain
{
    public class GradeAccountMapping
    {
        public long gam_id = 0;
        public string grade = "";
        public string account = "";
        public string account_grn = "";
        public DateTime created_date = new DateTime(1900, 1, 1);
        public DateTime modified_date = new DateTime(1900, 1, 1);

        public GradeAccountMapping() { }
        public GradeAccountMapping(SqlDataReader rd)
        {
            gam_id = Convert.ToInt32(rd["gam_id"]);
            grade = rd["grade"] is DBNull ? grade : rd["grade"].ToString();
            account = rd["account"] is DBNull ? account : rd["account"].ToString();
            account_grn = rd["account_grn"] is DBNull ? account_grn : rd["account_grn"].ToString();
            created_date = rd["created_date"] is DBNull ? created_date : Convert.ToDateTime(rd["created_date"]);
            modified_date = rd["modified_date"] is DBNull ? modified_date : Convert.ToDateTime(rd["modified_date"]);
        }
        public GradeAccountMapping(bool fromsoftmar, SqlDataReader rd)
        {
            grade = rd["grade"] is DBNull ? grade : rd["grade"].ToString();
        }
        public bool IsValidGradeAccountMapping()
        {
            return grade != string.Empty;
        }
    }
}
